package org.fastsyncer.manager.listener.mysql.binlog.impl.variable.status;

import java.io.IOException;

import org.fastsyncer.manager.listener.mysql.common.util.MySQLConstants;
import org.fastsyncer.manager.listener.mysql.common.util.ToStringBuilder;
import org.fastsyncer.manager.listener.mysql.io.XInputStream;

public class QSQLModeCode extends AbstractStatusVariable {
	public static final int TYPE = MySQLConstants.Q_SQL_MODE_CODE;

	private final long sqlMode;

	public QSQLModeCode(long sqlMode) {
		super(TYPE);
		this.sqlMode = sqlMode;
	}

	@Override
	public String toString() {
		return new ToStringBuilder(this)
		.append("sqlMode", sqlMode).toString();
	}

	public long getSqlMode() {
		return sqlMode;
	}

	public static QSQLModeCode valueOf(XInputStream tis) throws IOException {
		return new QSQLModeCode(tis.readLong(8));
	}
}
